@extends('admin.base')
@section('title', '参团详情')
@section('content')
<div id="main">
 <div class="layui-card">
    <fieldset class="layui-elem-field">
        <div class="layui-field-box">
            <a class="layui-btn-sm" href="{{url('admin/home')}}">首页</a>&raquo;
            <a class="layui-btn-sm" href="{{url('admin/group/index')}}">拼团列表</a>&raquo;
            <a class="layui-btn-sm" href="{{url('admin/group/cite?id='.$gid.'&page='.$request['page'])}}">拼团记录</a>&raquo;
            <span class="layui-breadcrumb" lay-separator=">>">
                <a class="layui-btn-sm" href="{{url('admin/group/cite_log?gid='.$gid.'&curcle='.$curcle)}}" style="cursor:pointer;" ><cite>参团详情</cite></a>;
            </span>
        </div>
    </fieldset>
   
    <div class="layui-card-body">
        <style>
            table tr td.tc,table tr th.tc {
                text-align: center;
                cursor:default;
            }
        </style>
        <table class="layui-table" lay-even lay-size="">
            <colgroup>
                <col width="">
                <col width="">
                <col width="">
                <col width="">
                <col width="">
                <col width="">
            </colgroup>
            <thead>
                <tr>
                    <th class="tc">ID</th>
                    <th class="tc">订单编号</th>
                    <th class="tc">账户</th>
                    <th class="tc">位置</th>
                    <th class="tc">收货人</th>
                    <th class="tc">联系方式</th>
                    <th class="tc">收货地址</th>
                    <th class="tc">赠送股票</th>
                    <th class="tc">状态</th>
                    <th class="tc">发货状态</th>
                    <th class="tc">创建时间</th>
                </tr>
                <tbody>
                    @if($list->isEmpty())
                        <tr>
                            <td colspan="19" class="tc">暂无数据</td>
                        </tr>
                    @else
                        @foreach ($list as $v)
                           <tr>
                            
                                <td class="tc">{{$v['id']}}</td>
                                <td class="tc">{{$v['sn']}}</td>
                                <td class="tc">{{$v['user']}}</td>
                                <td class="tc">
                                    {{$v['num']}}
                                </td>
                                <td class="tc">{{$v['linkman']}}</td>
                                <td class="tc">{{ $v['linktel'] }}</td>
                                <td class="tc">{{ $v['address'] }}</td>
                                <td class="tc">{{ $v['shares'] }}</td>
                                <td class="tc">@if($v['state'] == 1)
                                    待拼团
                                @elseif($v['state'] == 2)
                                    拼团成功
                                @elseif($v['state'] == 3)
                                    拼团成功，已中奖
                                @elseif($v['state'] == 4)
                                    拼团失败
                                @endif</td>
                                <td class="tc">
                                @if($v['state'] == 3)
                                    @if($v['status'] == 1)
                                        待发货
                                        @elseif($v['state'] == 2)
                                        待收货
                                        @elseif($v['state'] == 3)
                                        已完成
                                    @endif
                                @else
                                无
                                @endif
                                
                                </td>
                               <td class="tc">{{$v['created_at']}}</td>
                            </tr>
                        @endforeach
                    @endif
                </tbody>
            </thead>
        </table>
        <!-- 分页 -->
        <div class="sabrosus" >{{ $list->links() }}</div>
    </div>
 </div>
 </div>
@endsection
@section('js')
    <script>
        // 删除按钮事件 -- 弹出删除层
        var config = function(url,id,state,title){
            layer.confirm('确定更改('+title+')！', {
                btn: ['确定','取消'] //按钮
            },function(){
                $.post(url,{
                    id: id,state:state,
                },function(data){
                    console.log(data);
                    layer.msg(data.msg);
                    // if(data.code == 1){
                    //     layer.msg('更改成功！');
                    // }else{
                    //     layer.msg('更改失败！');
                    // }
                    location.href = location.href;
                });
            });
        }


        layui.use(['form','laydate'], function(){
            var form = layui.form;
            var laydate = layui.laydate;
            form.render();

            //搜索
            form.on('submit(selectsub)', function(data){
                var gid = $("input[name=sub_gid]").val();
                var gname = $("input[name=sub_gname]").val();
                var month = $("input[name=month]").val();
                location.href = "{{url('admin/group/index')}}"+"?gid=" + gid+ '&gname='+gname+'&month='+month;
                return false;
            });

            //日期时间选择器
            laydate.render({ 
                elem: '#test1'
                ,type: 'datetime'
            });


            //监听指定开关
            form.on('switch(switchCy)', function(data){
                var id = data.value;

                if(data.elem.checked){
                    var state = 1;//启用
                }else{
                    var state = 2;//禁用               
                }
                ajax('/admin/group/up_state',{id:id,state:state});
            });
        });
    </script>
@endsection